package com.miaoquan.mqportal.feign.hystrix;

import com.miaoquan.mqportal.feign.TklFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Component;

/**
 * fallback工厂类
 *
 * @author Fa
 * @date 2020-04-03 22:45
 */
@Component
public class TklFeignFactory implements FallbackFactory<TklFeign> {

    private final TklFeignFallback tklFeignFallback;

    public TklFeignFactory(TklFeignFallback tklFeignFallback) {
        this.tklFeignFallback = tklFeignFallback;
    }

    @Override
    public TklFeign create(Throwable cause) {
        //打印下异常
        cause.printStackTrace();
        return tklFeignFallback;
    }

}

